package jdk8;

import java.io.PrintStream;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
//对象实例方法引用
public class TestObjectInstanceMethodRef01 {
    public static void main(String[] args) {
        List<String> list= Arrays.asList("A","B","C");
        //传统方式(消费型接口应用)
        list.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println("s = " + s);
            }
        });
        //Lambda表达式方式
        list.forEach(t-> System.out.println("t = " + t));
        //方法引用方式
        PrintStream ps=System.out;
        list.forEach(ps::println);
        list.forEach(System.out::println);
    }
}
